package com.cloudcc.mobile.view.activity;

import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.cloudcc.cloudframe.CApplication;
import com.cloudcc.cloudframe.bus.DataEvent;
import com.cloudcc.cloudframe.bus.EventEngine;
import com.cloudcc.cloudframe.bus.EventList;
import com.cloudcc.cloudframe.bus.IEventLife;
import com.cloudcc.cloudframe.bus.MessageNumX;
import com.cloudcc.cloudframe.net.ErrorInfo;
import com.cloudcc.cloudframe.net.RequestListener;
import com.cloudcc.cloudframe.ui.viewgroup.CustomViewpager;
import com.cloudcc.cloudframe.ui.viewgroup.LazyViewPager;
import com.cloudcc.cloudframe.ui.viewgroup.VerticalScrollView;
import com.cloudcc.cloudframe.ui.viewgroup.refresh.PtrClassicDefaultHeader;
import com.cloudcc.cloudframe.ui.viewgroup.refresh.PtrClassicFrameLayout;
import com.cloudcc.cloudframe.ui.viewgroup.refresh.PtrDefaultHandler;
import com.cloudcc.cloudframe.ui.viewgroup.refresh.PtrFrameLayout;
import com.cloudcc.cloudframe.ui.viewgroup.refresh.PtrHandler;
import com.cloudcc.cloudframe.util.ListUtils;
import com.cloudcc.cloudframe.util.StringUtils;
import com.cloudcc.mobile.AppContext;
import com.cloudcc.mobile.R;
import com.cloudcc.mobile.adapter.DynamicAdapter;
import com.cloudcc.mobile.adapter.RelevantChatAdatper;
import com.cloudcc.mobile.dao.BeauInfoWeiTieDao;
import com.cloudcc.mobile.entity.ChatUser;
import com.cloudcc.mobile.entity.UserBasicInfoForUpdate;
import com.cloudcc.mobile.entity.beau.BeauInfoEntity;
import com.cloudcc.mobile.entity.beau.IsFollowmem;
import com.cloudcc.mobile.entity.beau.RelatedRole;
import com.cloudcc.mobile.im.UIControl;
import com.cloudcc.mobile.im.ui.AttentionActivity;
import com.cloudcc.mobile.im.ui.DetailMemberActivity;
import com.cloudcc.mobile.im.ui.MemberActivity;
import com.cloudcc.mobile.manager.ContactsManager;
import com.cloudcc.mobile.manager.RunTimeManager;
import com.cloudcc.mobile.manager.UrlManager;
import com.cloudcc.mobile.manager.UserManager;
import com.cloudcc.mobile.presenter.BeauPresenter;
import com.cloudcc.mobile.presenter.ContactPresenter;
import com.cloudcc.mobile.presenter.ContactsPresenter;
import com.cloudcc.mobile.presenter.OtherPresenter;
import com.cloudcc.mobile.presenter.UserPresenter;
import com.cloudcc.mobile.util.ImageUtils;
import com.cloudcc.mobile.util.SystemUtils;
import com.cloudcc.mobile.util.ToastUtil;
import com.cloudcc.mobile.util.UrlTools;
import com.cloudcc.mobile.util.UserUtils;
import com.cloudcc.mobile.util.ViewUtils;
import com.cloudcc.mobile.view.base.BaseActivity;
import com.cloudcc.mobile.view.dynamic.dynamic.DynamicFragment;
import com.cloudcc.mobile.view.fragment.MenuRightFragment;
import com.cloudcc.mobile.view.main.fragment.IContactUserInfo;
import com.cloudcc.mobile.weight.EmptyLayout;
import com.google.gson.Gson;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;
import com.litesuits.android.log.Log;
import com.mypage.bean.CnumberBean;
import com.mypage.bean.DetailGroupBean;
import com.mypage.utils.ImageLoaderUtilsGroup;
import com.mypage.utils.ImageLoaderUtils_circle;
import com.mypage.utils.SaveTemporaryData;
import com.mypage.utils.UtilsShowDialog;
import com.nostra13.universalimageloader.core.ImageLoader;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;

import static com.litesuits.android.async.AsyncExecutor.handler;

public class Myinformation extends BaseActivity implements RadioGroup.OnCheckedChangeListener, IContactUserInfo,IEventLife ,PtrHandler {
    //    @Bind(R.id.viewpager_my)
    public static Myinformation instance = null;
    CustomViewpager mViewPager;
    TextView name_my;
    View checkLine;
    ImageView logoimage, shexiangtou,groupImage;
    public int length1, length2, length3,length4; // 2:跟踪记录  3 ：详情  1 : 相关
    MyDynamicFragment mDynamicFragment;
    private AboutFragment aboutEvent;
    private MyDetailWeb mDetailFragment;
    private GroupDetailFragment groupFragment;
    private int currentIndex = 0;// 记录当前位置
    private float lineWidth;// 线的长度
    private LinearLayout ll_dianhua, ll_yunxin, ll_bianji;
    private LinearLayout.LayoutParams lp;
    private RelevantChatAdatper viewPagerAdapter;
    private ImageView chatmes_menubtn;
    private ImageView right;
    private List<BeauInfoEntity.ObjRelation> relationList;//相关列表信息
    private BeauPresenter mBeauPresenter = new BeauPresenter();
    RadioGroup radioGroup;
    private UserBasicInfoForUpdate mUserBasicInfo;
    private List<IsFollowmem.followitem> guanzhuData;
    private List<IsFollowmem.followitem> beiguanzhuData;
    public String groupDynamicId;
    private String tongshiShow = RunTimeManager.getInstance().getTongshi();
    public SlidingMenu menu_R;
    /**
     * @auter lyj 2017-7-20-21 15:16:58
     */
    public String mEmail;
    public String mNumber;
    public String mMobile;
    public int mSmart;
    public TextView title;
    public FrameLayout layoutFrame;
    private PtrClassicFrameLayout mRefreshLayoutx;
    private VerticalScrollView sv_myin;
    @Bind(R.id.message_num_tz)
    TextView message_num_tz;
    @Bind(R.id.message_num_99)
    TextView message_num_99;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        instance = this;
//        setContentView(R.layout.activity_myinformation_main);
        mRefreshLayoutx = (PtrClassicFrameLayout) findViewById(R.id.load_more_list_view_ptr_framex);
        sv_myin = (VerticalScrollView)findViewById(R.id.sv_myin);
        initview();
        initlistener();
        register();
        initdata();
        refreshInfoData();
        initMenu();
        initRefresh();
    }

//    @Override
//    protected void onNewIntent(Intent intent) {
////        if(sv_myin.isScrolledToTop){
////
////        }
//        super.onNewIntent(intent);
//        initdata();
//    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_myinformation_main;
    }
    public void onEventMainThread(MessageNumX event) {

        message_num_tz.setText(event.messageNumX+"");
        if(event.messageNumX>0) {
            message_num_tz.setVisibility(View.VISIBLE);
            if(event.messageNumX>99) {
                message_num_tz.setVisibility(View.INVISIBLE);
                message_num_99.setVisibility(View.VISIBLE);
            }

        }else {
            message_num_tz.setVisibility(View.INVISIBLE);
            message_num_99.setVisibility(View.INVISIBLE);
        }

    }
    //消息数
    public void MessageSetNCL(){
        long messagenum = 0;
        messagenum= RunTimeManager.getInstance().getMessageNx();
        message_num_tz.setText(messagenum+"");

        if(messagenum>0) {
            message_num_tz.setVisibility(View.VISIBLE);
            if(messagenum>99) {
                message_num_tz.setVisibility(View.INVISIBLE);
                message_num_99.setVisibility(View.VISIBLE);
            }

        }else {
            message_num_tz.setVisibility(View.INVISIBLE);
            message_num_99.setVisibility(View.INVISIBLE);
        }

    }
    private void initguanzhuData(final String isfollow) {
        HttpUtils utils = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addBodyParameter("binding", RunTimeManager.getInstance().getServerBinding());
        params.addBodyParameter("serviceName", "getFollowUsers");
        params.addBodyParameter("data", createJson(isfollow));
        Log.d("requestxx", UrlManager.getInterfaceUrl() + "?binding=" + RunTimeManager.getInstance().getServerBinding() + "&serviceName=\"getFollowUsers\"" + "&data=" + createJson(isfollow));
        utils.send(HttpRequest.HttpMethod.POST, UrlManager.getInterfaceUrl(), params, new RequestCallBack<String>() {

            @Override
            public void onFailure(HttpException arg0, String arg1) {
                // TODO Auto-generated method stub
                Log.d("request查询客户Fail", arg1);
            }

            @Override
            public void onSuccess(ResponseInfo<String> arg0) {
                // TODO Auto-generated method stub
                Log.d("request查询客户Fail", arg0.result.toString());
                Gson gson = new Gson();
                IsFollowmem follow = gson.fromJson(arg0.result.toString(),
                        IsFollowmem.class);

                if ("followme".equals(isfollow)) {
                    beiguanzhu_tv.setText(getResources().getString(R.string.beiguanzhu) + "(" + follow.data.size() + ")");
                    beiguanzhuData = follow.data;
                } else {
                    guanzhu_tv.setText(getResources().getString(R.string.zzgz) + "(" + follow.data.size() + ")");
                    guanzhuData = follow.data;
                }
            }
        });
    }

    //    public boolean relatedrole = false;
    public void requestRole() {
//        http://test.dev.cloudcc.com/distributor.action?serviceName=checkUserColleagueRole&
// colleagueId=00520173885A95Ap7isQ&binding=26E0BC86B099BEAD4593C3650EABE3AB
        HttpUtils utils = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addBodyParameter("binding", RunTimeManager.getInstance().getServerBinding());
        params.addBodyParameter("serviceName", "checkUserColleagueRole");
        params.addBodyParameter("colleagueId", id);
        Log.d("requestxx", UrlManager.getInterfaceUrl() + "?binding=" + RunTimeManager.getInstance().getServerBinding() + "&serviceName=checkUserColleagueRole" + "&colleagueId=" + id);
        utils.send(HttpRequest.HttpMethod.POST, UrlManager.getInterfaceUrl(), params, new RequestCallBack<String>() {

            @Override
            public void onFailure(HttpException arg0, String arg1) {
                // TODO Auto-generated method stub
                Log.d("request查询客户Fail", arg1);
            }

            @Override
            public void onSuccess(ResponseInfo<String> arg0) {
                // TODO Auto-generated method stub
                Log.d("request查询客户Fail", arg0.result.toString());
                Gson gson = new Gson();
                RelatedRole roleted = gson.fromJson(arg0.result.toString(),
                        RelatedRole.class);
                if ("true".equals(roleted.data.colleagueRsult)) {
//                    guanzhu.setVisibility(View.VISIBLE);
//                    beiguanzhu.setVisibility(View.VISIBLE);
                    qunzu.setVisibility(View.VISIBLE);
                } else {
//                    guanzhu.setVisibility(View.GONE);
//                    beiguanzhu.setVisibility(View.GONE);
                    qunzu.setVisibility(View.GONE);
                }
            }
        });
    }

    public void requestQunzuNum() {
//        http://test.dev.cloudcc.com/distributor.action?serviceName=checkUserColleagueRole&
// colleagueId=00520173885A95Ap7isQ&binding=26E0BC86B099BEAD4593C3650EABE3AB
        HttpUtils utils = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addBodyParameter("binding", RunTimeManager.getInstance().getServerBinding());
        params.addBodyParameter("serviceName", "getChatterGroupCount");
        params.addBodyParameter("userId", id);
        Log.d("requestxx", UrlManager.getInterfaceUrl() + "?binding=" + RunTimeManager.getInstance().getServerBinding() + "&serviceName=checkUserColleagueRole" + "&colleagueId=" + id);
        utils.send(HttpRequest.HttpMethod.POST, UrlManager.getInterfaceUrl(), params, new RequestCallBack<String>() {

            @Override
            public void onFailure(HttpException arg0, String arg1) {
                // TODO Auto-generated method stub
                Log.d("request查询客户Fail", arg1);
            }

            @Override
            public void onSuccess(ResponseInfo<String> arg0) {
                // TODO Auto-generated method stub
                Log.d("request查询客户Fail", arg0.result.toString());
                Gson gson = new Gson();
                RelatedRole roleted = gson.fromJson(arg0.result.toString(),
                        RelatedRole.class);
                try {
//                       qunzu_tv.setText("成员" + "(" +roleted.data.count+ ")");
                } catch (Exception ex) {

                }
            }
        });
    }


    public Bitmap imgphoto;

    //    public void onEventMainThread(EventList.UpdateUserEvent event) {
//        Bitmap imgphoto = MainUIActivity.imgphoto;
//        this.imgphoto = imgphoto;
//        logoimage.setImageBitmap(imgphoto);
//    }
    private void refreshLogo() {
//        String userId = UserManager.getManager().getUser().userId;
//        String url = UrlTools.getTopImage(userId);
//        UserUtils.setLogoRound_z(url, logoimage,
//                UserUtils.getBackGroudColorByUserIdHash(userId, Myinformation.this),
//                UserUtils.getNickRowName(mUserBasicInfo.getName()), Myinformation.this);

        try {

            if(RunTimeManager.getInstance().getUserId().equals(id)){
                if(AppContext.topicon==null){
                    String url = UrlTools.getTopImage(id);
                    ImageLoader.getInstance().displayImage(url , logoimage, ImageLoaderUtils_circle.MyDisplayImageOptions());
                    Bitmap imgphoto = ImageUtils.toRoundBitmap(UserManager.getManager().getLogoId(id));
                    logoimage.setImageBitmap(imgphoto);
                }

            }else{
                String url = UrlTools.getTopImage(id);
                ImageLoader.getInstance().displayImage(url , logoimage, ImageLoaderUtils_circle.MyDisplayImageOptions());
                Bitmap imgphoto = ImageUtils.toRoundBitmap(UserManager.getManager().getLogoId(id));
                logoimage.setImageBitmap(imgphoto);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


//        if ("me".equals(isme) || "shouye".equals(isme)) {
//            try {
//                String userId = UserManager.getManager().getUser().userId;
//                String url = UrlTools.getTopImage(userId);
//                UserUtils.setLogoRound_z(url, logoimage,
//                        UserUtils.getBackGroudColorByUserIdHash(userId, Myinformation.this),
//                        UserUtils.getNickRowName(mUserBasicInfo.getName()), Myinformation.this);
//                imgphoto = ImageUtils.toRoundBitmap(UserManager.getManager().getLogoId(id));
//                logoimage.setImageBitmap(imgphoto);
//            } catch (Exception ex) {
//
//            }
//        } else {
//            String url = UrlTools.getTopImage(id);
//            ImageLoader.getInstance().displayImage(url, logoimage, ImageLoaderUtils_circle.MyDisplayImageOptions());
//        }

    }

    public String createJson(String isfollow) {
        JSONObject object = new JSONObject();
        try {
            object.put("userId", mUserBasicInfo.userId);
            String a = id;
            object.put("followType", isfollow);
            // Log.d("/////////////////", object.toString());
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return object.toString();

    }

    /**
     * 裁剪图片方法实现
     *
     * @param uri
     */
    private void startPhotoZoom(Uri uri) {
        Intent intent = new Intent("com.android.camera.action.CROP");
        intent.setDataAndType(uri, "image/*");
        // 下面这个crop=true是设置在开启的Intent中设置显示的VIEW可裁剪
        intent.putExtra("crop", "true");
        // aspectX aspectY 是宽高的比例
        intent.putExtra("aspectX", 1);
        intent.putExtra("aspectY", 1);
        // outputX outputY 是裁剪图片宽高
        intent.putExtra("outputX", 150);
        intent.putExtra("outputY", 150);
        intent.putExtra("return-data", true);
        startActivityForResult(intent, 3);
    }

    private String picPath;
    public Bitmap photo;
    private UserPresenter userPresenter = new UserPresenter();
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        if (data == null)
            return;
        super.onActivityResult(requestCode, resultCode, data);
        Log.d("activityresultcode", resultCode + "  " + requestCode);
        if (resultCode == Activity.RESULT_OK && requestCode == 70) {
            // imageView不设null, 第一次上传成功后，第二次在选择上传的时候会报错。
            picPath = data.getStringExtra(SelectPicActivity.KEY_PHOTO_PATH);
            File temp = new File(picPath);
            startPhotoZoom(Uri.fromFile(temp));

        } else if (resultCode == Activity.RESULT_OK && requestCode == 3) {
            logoimage.setImageBitmap(null);
            if (data != null) {
                Bundle extras = data.getExtras();
                if (extras != null) {
                    photo = extras.getParcelable("data");
                    imgphoto = ImageUtils.toRoundBitmap(photo);
                    logoimage.setImageBitmap(imgphoto);
                    UserManager.getManager().saveLogo(photo);
                    AppContext.topicon = imgphoto;

                    userPresenter.UpdateLogo(photo, UserManager.getManager()
                            .getUser());
                }
            } else {
                byte[] imagebyte = ImageUtils.readSdcard(picPath);
                photo = ImageUtils.loadBitmap(imagebyte, 100, 100);
                imgphoto = ImageUtils.toRoundBitmap(photo);
                logoimage.setImageBitmap(imgphoto);

                userPresenter.UpdateLogo(photo, UserManager.getManager()
                        .getUser());
            }
        } else if (requestCode == 309 && resultCode == 101) {
            mEmail = data.getStringExtra("Email");
            mNumber = data.getStringExtra("Number");
            mMobile = data.getStringExtra("Mobile");
            mSmart = data.getIntExtra("smart", 0);
//            if(mSmart==1){
//                setRadioBtnb();
//            }

        }
    }

    private String mEns = RunTimeManager.getInstance().getlanguage();

    private void initlistener() {
        //头像
        logoimage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (RunTimeManager.getInstance().getUserId().equals(id)) {
                    Intent intent = new Intent(Myinformation.this,
                            SelectPictureActivity.class);
                    startActivityForResult(intent, 70);
                } else {
                    return;
                }
            }
        });
        chatmes_menubtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SaveTemporaryData.suoYouRen="";
                SaveTemporaryData.mSmart="member";



                SaveTemporaryData.General = true;
                SaveTemporaryData.detailDyamic = "detailDyamic";
                finish();
            }
        });
        right.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                menu_R.showMenu();
            }
        });
        ll_bianji.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Myinformation.this, UpdateInfoActivity.class);
                UserBasicInfoForUpdate userBasicInfoForUpdate = new UserBasicInfoForUpdate();
                userBasicInfoForUpdate.setEmail(mUserBasicInfo.getEmail());
                userBasicInfoForUpdate.setMobile(mUserBasicInfo.getMobile());
                userBasicInfoForUpdate.setPhone(mUserBasicInfo.getPhone());
                userBasicInfoForUpdate.setTitle(mUserBasicInfo.getTitle());
                userBasicInfoForUpdate.setAddress(mUserBasicInfo.getAddress());
                userBasicInfoForUpdate.setName(mUserBasicInfo.getName());
                intent.putExtra("chatuser", userBasicInfoForUpdate);//
//                intent.putExtra("chatuser", mViewPager.getCurrentItem());
                startActivityForResult(intent, 309);
            }
        });
        ll_yunxin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // TODO Auto-generated method stub
                if ("cc201307019DXlPd701".equals(RunTimeManager.getInstance().getOrgId())) {
                    Toast.makeText(Myinformation.this, "您好，体验版本无法使用聊天功能", 1).show();
                } else {
                    if("true".equals(tongshiShow)) {
                        if (user != null) {
                            SharedPreferences pref = Myinformation.this.getSharedPreferences(
                                    "data", 0);
                            SharedPreferences.Editor editor = pref.edit();
                            editor.clear();
                            editor.commit();
                            if (UserUtils.isMe(id)) {
                                if (("en".equals(mEns))) {
                                    Toast.makeText(Myinformation.this, "I'm sorry I can not chat with myself...", Toast.LENGTH_SHORT).show();
                                } else {
                                    Toast.makeText(Myinformation.this, "对不起不能自己跟自己聊天...", Toast.LENGTH_SHORT).show();
                                }

                            } else {
                                UIControl.openChatUI(Myinformation.this, ContactsManager.getInstance().encodeHXuserName(id), name, false);

                            }
                        }
                    }else {
                        Toast.makeText(Myinformation.this, getResources().getString(R.string.yunxinqx), Toast.LENGTH_SHORT).show();
                    }

                }
            }
        });
        ll_dianhua.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String mobilePhone = mUserBasicInfo.getMobile();
                if (StringUtils.isNotBlank(mobilePhone)) {
                    SystemUtils.sendCall(Myinformation.this, mobilePhone);
                } else {
                    if ("en".equals(mEns)) {
                        Toast.makeText(Myinformation.this, "The colleague did not enter the phone", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(Myinformation.this, "该同事未录入电话", Toast.LENGTH_SHORT).show();
                    }
                }
            }
        });
    }

    private void refreshInfoData() {
    }

    String id, name;
    String mStrId;
    public String chatter;
    String isme = "";
    String Ownoneself;

    private void initdata() {
        Ownoneself = getIntent().getStringExtra("Ownoneself");
            getGroupMember();
        try {
            isme = getIntent().getStringExtra("isme");
            if ("me".equals(isme)) {
                mUserBasicInfo = (UserBasicInfoForUpdate) getIntent()
                        .getSerializableExtra("chatuser");
                name_my.setText(mUserBasicInfo.getName());
                ll_bianji.setVisibility(View.VISIBLE);
                ll_dianhua.setVisibility(View.GONE);
                ll_yunxin.setVisibility(View.GONE);
                id = mUserBasicInfo.userId;
                title.setText(getResources().getString(R.string.gerenxinxi));
                initviewpager();
                refreshLogo();
                mRefreshLayoutx.refreshComplete();
            } else {
                title.setText("");
                if ("shouye".equals(isme)||"cowme".equals(isme)) {
                    ll_bianji.setVisibility(View.VISIBLE);
                    ll_dianhua.setVisibility(View.GONE);
                    ll_yunxin.setVisibility(View.GONE);
                    title.setText(getResources().getString(R.string.gerenxinxi));
                } else {
                    ll_bianji.setVisibility(View.GONE);
                    ll_dianhua.setVisibility(View.VISIBLE);
                    ll_yunxin.setVisibility(View.VISIBLE);
                }
                id = getIntent().getStringExtra("userId");
                mStrId= getIntent().getStringExtra("userId");
                name = getIntent().getStringExtra("name");
                name_my.setText(name);
                if(RunTimeManager.getInstance().getUserId().equals(id)){
                    ll_bianji.setVisibility(View.VISIBLE);
                    ll_dianhua.setVisibility(View.GONE);
                    ll_yunxin.setVisibility(View.GONE);
                    title.setText(getResources().getString(R.string.gerenxinxi));
                }
                requestData(id);
//                setRadioBtnc();
            }
//            try {
//                Intent intent=getIntent();
//                Bundle b=intent.getExtras();
//                byte[] bytes=b.getByteArray("bitmap");
//                Bitmap bmp= BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
//                if(null!=bmp){
//                    logoimage.setImageBitmap(bmp);
//                }
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//            Bitmap imgphoto = ((MainUIActivity) getActivity()).imgphoto;
//            this.imgphoto = imgphoto;
//            user_follow.setImageBitmap(imgphoto);
            if ("me".equals(isme) || "shouye".equals(isme)) {
                shexiangtou.setVisibility(View.VISIBLE);
            } else {
                shexiangtou.setVisibility(View.GONE);
            }
        } catch (Exception ex) {

        }

    }

    private ContactPresenter mContactPresenter;
    protected ContactsPresenter mContactsPresenter = new ContactsPresenter();
    private ChatUser user;

    private void requestData(String id) {
        mContactPresenter.getUserInfoChatter(id);
    }

    @Override
    public void onGettedUser(DataEvent<ChatUser> event) {
        // TODO Auto-generated method stub
        if (event.isError()) {
            return;
        }
        user = event.getData();
        UserBasicInfoForUpdate userBasicInfoForUpdate = new UserBasicInfoForUpdate();
//				Intent intent = new Intent(mContext, UpdateInfoActivity.class);
//				Intent intent = new Intent(getActivity(), NeweditorActivity.class);
        userBasicInfoForUpdate.setEmail(user.getEmail() + " ");
        userBasicInfoForUpdate.setMobile(user.getMobile());
        userBasicInfoForUpdate.setPhone(user.getPhone());

        userBasicInfoForUpdate.setProfilename(user.getProfilename());
        userBasicInfoForUpdate.setRolename(user.getRolename());
//				userBasicInfoForUpdate.setTitle(user.getTitle());
//				userBasicInfoForUpdate.setAddress(user.getAddress());
//				userBasicInfoForUpdate.setAbout(user.getAboutme());
//				userBasicInfoForUpdate.setImg(user.getImg());
        userBasicInfoForUpdate.setName(user.getName());
        userBasicInfoForUpdate.userId = user.getUserid();
        userBasicInfoForUpdate.setImgphoto(imgphoto);
        mUserBasicInfo = userBasicInfoForUpdate;
        initviewpager();
        //群组的权限 现在去掉
//        requestRole();
        //图片的加载
        refreshLogo();
        //显示是否关注
//        initGuanzhu();
//        refreshLogo();
        mRefreshLayoutx.refreshComplete();
    }
    public  TextView groupMember;
    public LinearLayout layoutLinearInfo;
    private void initview() {
        layoutLinearInfo = (LinearLayout) findViewById(R.id.layoutLinearInfo);
        mContactPresenter = new ContactPresenter((IContactUserInfo) Myinformation.this);
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int screenWidth = dm.widthPixels;
        lineWidth = screenWidth / 3;
        layoutFrame = (FrameLayout) findViewById(R.id.layoutFrame);
        radioGroup = (RadioGroup) findViewById(R.id.radiogroup);
        mViewPager = (CustomViewpager) findViewById(R.id.viewpager_my);
        checkLine = findViewById(R.id.beau_info_check_line);
        name_my = (TextView) findViewById(R.id.name_my);
        chatmes_menubtn = (ImageView) findViewById(R.id.chatmes_menubtn);
        ll_dianhua = (LinearLayout) findViewById(R.id.beau_callll);
        ll_yunxin = (LinearLayout) findViewById(R.id.yunxin);
        ll_bianji = (LinearLayout) findViewById(R.id.bianji);
        logoimage = (ImageView) findViewById(R.id.imageView8);
        groupImage = (ImageView) findViewById(R.id.imageView9);
        groupMember = (TextView) findViewById(R.id.groupMember);
        shexiangtou = (ImageView) findViewById(R.id.shexiangtou);
        title = (TextView) findViewById(R.id.textView1);
        right = (ImageView) findViewById(R.id.right);
        radioGroup.setOnCheckedChangeListener(this);

        logoimage.setImageBitmap(AppContext.topicon);

    }
//    这是这个方法mDynamicFragment.requestData();只调用一次
    private boolean isFirsttransfer =true;
    private void initviewpager() {
//        ViewTreeObserver vto = mViewPager.getViewTreeObserver();
        mDynamicFragment = new MyDynamicFragment();
        aboutEvent = new AboutFragment();
        // sdsds
        mDetailFragment = new MyDetailWeb();
        groupFragment = new GroupDetailFragment();
        // 赋值
        if (isFirsttransfer){
            isFirsttransfer = false;
            mDynamicFragment.requestData();
        }

        ArrayList<Fragment> views = new ArrayList<Fragment>();
        views.add(mDynamicFragment);

        if ("member".equals(SaveTemporaryData.mSmart)){
            views.add(groupFragment);
        }else {
            views.add(mDetailFragment);
        }
        views.add(aboutEvent);
        // mViewPager.setFocusable(true);
        mViewPager.setTouch(false);
        mViewPager.setOnPageChangeListener(new LazyViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                if (position == 0) {
                    topBarChange(0);
                    RadioButton b = (RadioButton) findViewById(R.id.beau_genzong);
                    b.setChecked(true);
                    setHeight(length2);
                }
                if (position == 1) {
                    topBarChange(1);
                    RadioButton b = (RadioButton) findViewById(R.id.beau_detail);
                    b.setChecked(true);
                    setHeight(length3);
                }
                if (position == 2) {
                    RadioButton b = (RadioButton) findViewById(R.id.beau_about);
                    topBarChange(2);
                    b.setChecked(true);
                    setHeight(800);
                }

            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
        if (viewPagerAdapter == null) {
            viewPagerAdapter = new RelevantChatAdatper(
                    getSupportFragmentManager(), views);
            mViewPager.setAdapter(viewPagerAdapter);
            mViewPager.hasSetTouchMode = true;
            mViewPager.setOffscreenPageLimit(2);
        }

    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        switch (checkedId) {
            case R.id.beau_genzong:// 跟踪记录
                // if (mViewPager.getCurrentItem() != 1) {
//                topBarChange(0);
                mViewPager.setCurrentItem(0);

//                isnum = 2;
//                isxianshi = true;
//                setHeight(length2);
                break;
            case R.id.beau_detail:// 详情信息
//                topBarChange(1);
                mViewPager.setCurrentItem(1);
//                isnum = 1;
//                setHeight(length3);
                break;
            case R.id.beau_about:// 相关
//                topBarChange(2);
                mViewPager.setCurrentItem(2);
//                isnum = 3;
//                setHeight(length1);
                break;
        }

    }

    private void topBarChange(int pagerIndex) {
        //改变红线位置
        float fromX = lineWidth * (currentIndex);
        float toX = lineWidth * (pagerIndex);
        Animation animation = new TranslateAnimation(fromX, toX, 0, 0);
        animation.setFillAfter(true);
        animation.setDuration(300);
        checkLine.startAnimation(animation);
        currentIndex = pagerIndex;
    }

    public void initGuanzhu() {
        if (user.isIsfollowme()) {
            btn_guanzhu_tv.setText(getResources().getString(R.string.yiguanzhu));
        } else {
            btn_guanzhu_tv.setText(getResources().getString(R.string.guanzhu));
        }
        btn_guanzhu_tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(RunTimeManager.getInstance().getUserId().equals(id)){
                    Toast.makeText(Myinformation.this, R.string.noguanzhu,Toast.LENGTH_SHORT).show();
                    return;
                }
                new OtherPresenter().followPeople(id, user.isIsfollowme(),
                        new RequestListener() {
                            @Override
                            public void onSuccess(Object arg0) {
                                user.setIsfollowme(!user.isIsfollowme());
                                if ("en".equals(mEns)) {
                                    if (user.isIsfollowme()) {
                                        btn_guanzhu_tv.setText("Has been concerned");
                                    } else {
                                        btn_guanzhu_tv.setText("attention");
                                    }
                                } else {
                                    if (user.isIsfollowme()) {
                                        btn_guanzhu_tv.setText(R.string.yiguanzhu);
                                    } else {
                                        btn_guanzhu_tv.setText(R.string.guanzhu);
                                    }
                                }

                            }

                            @Override
                            public void onFailure(ErrorInfo arg0) {
                            }
                        });
            }
        });
    }

    private TextView btn_guanzhu_tv;
    private LinearLayout ll_guanzhu;
    private UtilsShowDialog showDialog = new UtilsShowDialog(Myinformation.this);

    @Override
    public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
        return PtrDefaultHandler.checkContentCanBePulledDown(frame, sv_myin,header);
    }

    @Override
    public void onRefreshBegin(PtrFrameLayout frame) {
        initdata();
    }

    private void initRefresh() {
        mRefreshLayoutx.setLoadingMinTime(1000);
        mRefreshLayoutx.setPtrHandler(this);
        //1.默认经典头布局
        PtrClassicDefaultHeader header = new PtrClassicDefaultHeader(mContext);
        int[] colors = getResources().getIntArray(R.array.google_colors);
//        header.setColorSchemeColors(colors);
//        header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
//        header.setPadding(0, DensityUtils.dpToPixel(mContext, 10), 0,
//                DensityUtils.dpToPixel(mContext, 5));
//        header.setPtrFrameLayout(mRefreshLayoutx);
        mRefreshLayoutx.setHeaderView(header);
        mRefreshLayoutx.addPtrUIHandler(header);

    }
    public class MyDynamicFragment extends DynamicFragment {

        private EmptyLayout empty_loading;


        @Override
        public void init() {
            BeauInfoWeiTieDao.getInstance().addBeauInfoweiTie(new BeauInfoWeiTieDao.BeauInfoWeiTie() {
                @Override
                public void WeiTieSuccess() {
                    requestData();
                }
            });
            btn_guanzhu_tv = (TextView) findViewById(R.id.btn_guanzhu_tv);
            ll_guanzhu = (LinearLayout) findViewById(R.id.ll_guanzhu);
            if (RunTimeManager.getInstance().getUserId().equals(id)) {
                ll_guanzhu.setVisibility(View.GONE);
            } else {
                ll_guanzhu.setVisibility(View.VISIBLE);
            }

            mRefreshLayout.setEnabled(false);
            initLoadMore();
            mListView.setBackgroundColor(Color.parseColor("#57F2F8F8"));
            mAdapter = new DynamicAdapter(mContext);
            mListView.setAdapter(mAdapter);
            mAdapter.setOnItemtListener(this);
            if ("me".equals(isme)) {

            }else{
                initGuanzhu();
            }

            if (empty_loading == null) {
                empty_loading = new EmptyLayout(mContext);
                empty_loading.setLayoutParams(new ViewGroup.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                ViewUtils.addListViewEmptyView(mContext, mListView, empty_loading);
            }
        }

        @Override
        public String getQueryType() {
            return "me";
        }
        @Override
        public void requestData() {
//            mControl.getDynamicsAboutRecord(currentPage, mEntityId);
//            sss
//            mControl.getDynamicForOne(currentPage, mUserBasicInfo.userId);
            if ("detailDyamic".equals(SaveTemporaryData.detailDyamic)){
                mControl.getDynamicForOne(currentPage, SaveTemporaryData.ID);
            }else{
                mControl.getDynamicForOne(currentPage, mUserBasicInfo.userId);
            }

//            showDialog.onShowLoadingDialog("正在加载...");

        }

        @Override
        public int getLayoutId() {
            return super.getLayoutId();
        }

        public void onEventMainThread(EventList.DynamicEvent event) {
            empty_loading.hide();
            if ((event.isError() && isFromRefresh())
                    || (ListUtils.isEmpty(event.getData().data) && isFromRefresh())) {  // 加载数据为空
                length2 = 600;
                empty_loading.empty();
                if (mAdapter != null) {
                    mAdapter.clear();
                }
                if (mViewPager.getCurrentItem() == 0) {
                    setHeight(length2);
                }
//                showDialog.onDismissLoadingDialog();
                return;
            }

            if (isFromRefresh()) {
                mAdapter.changeData(event.getData().data);
            } else {
                mAdapter.addData(event.getData().data);
            }
            if (event.getData().data.size() > 0 && mAdapter != null) {
                length2 = 0;
                for (int i = 0; i < mAdapter.getCount(); i++) {
                    View view = mAdapter.getView(i, null, mListView);
                    view.measure(0, 0);
                    length2 = length2 + view.getMeasuredHeight() + mListView.getDividerHeight();
                }
            }
            length2 = length2 + 200;
            if (mViewPager.getCurrentItem() == 0) {
                setHeight(length2);
            }
//            showDialog.onDismissLoadingDialog();
        }

        @Override
        protected void onRequestFinish(boolean dataIsEmpty) {
            mLoadMoreLayout.loadMoreFinish(false, true);
        }

        @Override
        protected void initRequestData() {
            // 禁止自动刷新
        }

        @Override
        public void onResume() {
            if (SaveTemporaryData.General){
                SaveTemporaryData.detailDyamic = "";
                mControl.getDynamicForOne(currentPage, SaveTemporaryData.ID);
                SaveTemporaryData.General = false;
            }else {
                mControl.getDynamicForOne(currentPage, mUserBasicInfo.userId);
            }
//            if ("成员返回到群组详情页"){
//                mControl.getDynamicForOne(currentPage, SaveTemporaryData.ID);
//            }
            super.onResume();
            if (mViewPager.getCurrentItem() == 0) {
                Intent intent = new Intent(AppContext.INDEXADAPTER_SHUAXIN);
                mContext.sendBroadcast(intent);
            }
            mAdapter.notifyDataSetChanged();
        }

        @Override
        public void onStop() {
            super.onStop();
            ll_guanzhu.setVisibility(View.GONE);
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
//        showDialog.onDismissLoadingDialog();
    }

    private TextView qunzu_tv, beizhu_tv, guanzhu_tv, beiguanzhu_tv;
    private TextView member;
    private LinearLayout qunzu, beizhu, guanzhu, beiguanzhu,layoutMember,layoutLinear;

    public class AboutFragment extends Fragment {
        @Override
        public View onCreateView(LayoutInflater inflater,
                                 @Nullable ViewGroup container,
                                 @Nullable Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            View view = View.inflate(getActivity(), R.layout.my_infmation_about, null);
            layoutLinear = (LinearLayout) view.findViewById(R.id.layoutLinear);
            qunzu_tv = (TextView) view.findViewById(R.id.qunzu_tv);
            qunzu = (LinearLayout) view.findViewById(R.id.qunzu);
            layoutMember = (LinearLayout) view.findViewById(R.id.layoutMember);
            member = (TextView) view.findViewById(R.id.tvContentMember);
            beizhu_tv = (TextView) view.findViewById(R.id.beizhu_tv);
            beizhu = (LinearLayout) view.findViewById(R.id.beizhu);
            guanzhu_tv = (TextView) view.findViewById(R.id.guanzhu_tv);
            guanzhu = (LinearLayout) view.findViewById(R.id.guanzhu);
            beiguanzhu_tv = (TextView) view.findViewById(R.id.beiguanzhu_tv);
            beiguanzhu = (LinearLayout) view.findViewById(R.id.beiguanzhu);
//            qunzu_tv.setText("群组 " + "(" + EMGroupManager.getInstance().getAllGroups().size() + ")");
            addlistener();
//            register();
//            initguanzhuData("followme");
//            initguanzhuData("mefollow");
//            requestQunzuNum();
            getMemberNumbew();//成员数据的个数
            return view;
        }

        @Override
        public void onResume() {
            setView();
            initguanzhuData("followme");
//            getMemberNumbew();//成员数据的个数
            initguanzhuData("mefollow");
            super.onResume();

        }
        private void setView(){
            String headerImageUrl = UrlManager.getInterfaceUrl()+"?serviceName=showChatterImage&type=group&id="+SaveTemporaryData.ID+"&binding="+RunTimeManager.getInstance().getServerBinding();
            //qunzu chengyuan  fanhui
            if ("member".equals(SaveTemporaryData.mSmart)){
                ll_guanzhu.setVisibility(View.GONE);
                layoutFrame.setVisibility(View.GONE);
                layoutLinear.setBackgroundColor(Color.rgb(243,246,249));
                logoimage.setVisibility(View.GONE);
                groupImage.setVisibility(View.VISIBLE);
                name_my.setText(name);
                name_my.setTextColor(Color.rgb(14,42,86));
                name_my.setTextSize(18);

//                logoimage.setImageResource(R.drawable.icomgroupdetail);
                ImageLoader.getInstance().displayImage(headerImageUrl, groupImage , ImageLoaderUtilsGroup.MyDisplayImageOptions());

                groupMember.setVisibility(View.VISIBLE);
                layoutMember.setVisibility(View.VISIBLE);
                beiguanzhu.setVisibility(View.GONE);
                guanzhu.setVisibility(View.GONE);
                qunzu.setVisibility(View.GONE);
            }else if ("suoYouRen".equals(SaveTemporaryData.suoYouRen)){
                SaveTemporaryData.suoYouRen="";
                layoutLinear.setBackgroundColor(Color.rgb(255,255,255));
                logoimage.setVisibility(View.VISIBLE);
                groupImage.setVisibility(View.GONE);
                layoutMember.setVisibility(View.GONE);
                groupMember.setVisibility(View.GONE);
                beiguanzhu.setVisibility(View.VISIBLE);
                guanzhu.setVisibility(View.VISIBLE);
                qunzu.setVisibility(View.VISIBLE);
            }else{
                layoutLinear.setBackgroundColor(Color.rgb(255,255,255));
                logoimage.setVisibility(View.VISIBLE);
                groupImage.setVisibility(View.GONE);
                layoutMember.setVisibility(View.GONE);
                groupMember.setVisibility(View.GONE);
                beiguanzhu.setVisibility(View.VISIBLE);
                guanzhu.setVisibility(View.VISIBLE);
                qunzu.setVisibility(View.VISIBLE);
            }
            SaveTemporaryData.mSmart = "";
        }
        private void addlistener() {
            layoutMember.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {

                    Intent intent2 = new Intent(getActivity(), DetailMemberActivity.class);
                    Bundle guanzhux = new Bundle();
                    guanzhux.putString("istongshi", "detailmember");
                    guanzhux.putString("isguanzhu_uid", mUserBasicInfo.userId);
                    guanzhux.putString("groupId",SaveTemporaryData.ID);
                    intent2.putExtras(guanzhux);
                    startActivity(intent2);
                }


            });
            qunzu.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    // TODO Auto-generated method stub
//                    if ("cc201307019DXlPd701".equals(RunTimeManager.getInstance().getOrgId())) {
//                        Toast.makeText(Myinformation.this, getResources().getString(R.string.tiyan), Toast.LENGTH_SHORT).show();
//                    } else {
//                        startActivity(new Intent(getActivity(), GroupsActivity.class));
//                    }


                    Intent intent2 = new Intent(getActivity(), MemberActivity.class);
//                    Intent intent2 = new Intent(getActivity(), GuanzhuActivity.class);
                    Bundle guanzhux = new Bundle();
//                    guanzhux.putSerializable("guanzhumei", (Serializable) guanzhuData);
                    guanzhux.putString("istongshi", "chengyuan");
                    if(mStrId == null || mStrId.length() <= 0){
                        mStrId = RunTimeManager.getInstance().getUserId();
                    }
                    guanzhux.putString("isguanzhu_uid", mStrId);
                    intent2.putExtras(guanzhux);
                    startActivity(intent2);
                }


            });
            beiguanzhu.setOnClickListener(new View.OnClickListener() {
                @Override
                protected Object clone() throws CloneNotSupportedException {
                    return super.clone();
                }

                @Override
                public void onClick(View v) {
                    Intent intent1 = new Intent(getActivity(), AttentionActivity.class);
                    Bundle guanzhux = new Bundle();
//                        guanzhux.putSerializable("guanzhumei", (Serializable) beiguanzhuData);
                    guanzhux.putString("istongshi", "beiguanzhu");
                    guanzhux.putString("isguanzhu_x", "shide");
                    guanzhux.putString("isguanzhu_uid", mUserBasicInfo.userId);
                    intent1.putExtras(guanzhux);
                    startActivity(intent1);

//                    Intent intent1 = new Intent(getActivity(), GuanzhuActivity.class);
//                    Bundle guanzhux = new Bundle();
//                    guanzhux.putSerializable("guanzhumei", (Serializable) guanzhuData);
//                    guanzhux.putString("istongshi","tongshi");
//                    intent1.putExtras(guanzhux);
//                    startActivity(intent1);
                }
            });
            guanzhu.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent2 = new Intent(getActivity(), AttentionActivity.class);
//                    Intent intent2 = new Intent(getActivity(), GuanzhuActivity.class);
                    Bundle guanzhux = new Bundle();
//                    guanzhux.putSerializable("guanzhumei", (Serializable) guanzhuData);
                    guanzhux.putString("istongshi", "guanzhu");
                    guanzhux.putString("isguanzhu_uid", mUserBasicInfo.userId);
                    intent2.putExtras(guanzhux);
                    startActivity(intent2);
                }
            });
        }

    }

    //相关
    public void setRadioBtnc() {
        RadioButton b = (RadioButton) findViewById(R.id.beau_about);
        mViewPager.setCurrentItem(2);
        topBarChange(2);
        b.setChecked(true);
        setHeight(length1);
    }

    //跟踪记录
    public void setRadioBtnb() {
        mViewPager.setCurrentItem(0);
        topBarChange(0);
        RadioButton b = (RadioButton) findViewById(R.id.beau_genzong);
        b.setChecked(true);
        setHeight(length2);
    }

    //详情信息
    public void setRadioBtna() {
        mViewPager.setCurrentItem(1);
        topBarChange(1);
        RadioButton b = (RadioButton) findViewById(R.id.beau_detail);
        b.setChecked(true);
        setHeight(length3);
    }
    public class GroupDetailFragment extends Fragment{
        private TextView tvName;
        private TextView tvRemarks;
        private TextView tvPersion;
        private TextView tvType;
        private LinearLayout   layoutLinearGroup,layoutBeizhu;
        public DetailGroupBean groupInfo;

        @Nullable
        @Override
        public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
            View view = View.inflate(getActivity(),R.layout.persion_group_detail,null);
            layoutLinearGroup = (LinearLayout) view.findViewById(R.id. layoutLinearGroup);
            layoutBeizhu = (LinearLayout) view.findViewById(R.id. layoutBeizhu);
            tvName = (TextView) view.findViewById(R.id.tvName);//名称
            tvRemarks = (TextView) view.findViewById(R.id.tvRemarks);//备注
            tvPersion = (TextView) view.findViewById(R.id.tvPersion);//所有人
            tvType = (TextView) view.findViewById(R.id.tvType);//访问类型
            int width = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
            int height = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
            layoutLinearGroup.measure(width, height);
            length3 = layoutLinearGroup.getMeasuredHeight()+300;;
            initData();
            Listnenr();
            return view;
        }
        public void initData(){
            groupDetail();
            layoutLinearGroup.setBackgroundColor(Color.rgb(255,255,255));
        }
        public void groupDetail() {
            HttpUtils utils = new HttpUtils();
            RequestParams params = new RequestParams();
            params.addBodyParameter("binding", RunTimeManager.getInstance().getServerBinding());
            params.addBodyParameter("serviceName", "getChatterGroupInfo");
            params.addBodyParameter("groupId", SaveTemporaryData.ID);
            Log.d("request详细信息",UrlManager.getInterfaceUrl()+"?binding="+RunTimeManager.getInstance().getServerBinding()+"&serviceName=getChatterGroupInfo&groupId="+SaveTemporaryData.ID);
            utils.send(HttpRequest.HttpMethod.POST, UrlManager.getInterfaceUrl(), params, new RequestCallBack<String>() {

                @Override
                public void onFailure(HttpException arg0, String arg1) {

                }

                @Override
                public void onSuccess(ResponseInfo<String> arg0) {
                    String mJson = arg0.result;
                    groupDetailInfo(mJson);
                }
            });

        }
        public void groupDetailInfo(String json){
             groupInfo = new Gson().fromJson(json,DetailGroupBean.class);
            try{
                tvName.setText(groupInfo.data.name);
                tvRemarks.setText(groupInfo.data.description);
                tvPersion.setText(groupInfo.data.ownerIdccname);//所有人
                tvType.setText(groupInfo.data.groupType);
                groupMember.setText(groupInfo.data.groupType+" · "+groupInfo.data.membercount+getString(R.string.detailmember));

            }catch (Exception e){

            }

        }
        public void Listnenr(){
            tvPersion.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
//                    Intent intent = new Intent(getActivity(),
//                            Myinformation.class);
////                  if (RunTimeManager.getInstance().getUserId().equals(groupInfo.data.id)) {
////                       intent.putExtra("isme", "cowme");
////                  }
//                    intent.putExtra("userId", groupInfo.data.id);
////                  SaveTemporaryData.ID = groupInfo.data.id;
//                    SaveTemporaryData.suoYouRen = "suoYouRen";
//                    intent.putExtra("name", groupInfo.data.ownerIdccname);





//                    ---------------------------------------
                    Intent intent = new Intent(mContext,
                            Myinformation.class);
                    SaveTemporaryData.General = true;
                    SaveTemporaryData.GeneralOne = true;
                    intent.putExtra(
                            UserInfoActivity.KEY_USERID, groupInfo.data.ownerId);
                    intent.putExtra("userId", groupInfo.data.ownerId);
                    intent.putExtra("name",groupInfo.data.ownerIdccname);
                    SaveTemporaryData.mSmart = "";
                    mContext.startActivity(intent);
//                    ----------------------------------------












//                    mContext.startActivity(intent);
                }
            });
        }

        @Override
        public void onResume() {
            super.onResume();
            setHeight(length3);
            layoutLinearInfo.setBackgroundColor(Color.rgb(255,255,255));
        }
    }
    public class MyDetailWeb extends Fragment {
        LinearLayout linearLayout, layoutLinearDetail;
        private TextView tv_name, tv_email, tv_jiaose, tv_jiandang, tv_phone,
                tv_shouji;

        @Override
        public View onCreateView(LayoutInflater inflater,
                                 @Nullable ViewGroup container,
                                 @Nullable Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            View view = View.inflate(getActivity(), R.layout.about_me_xiangxi, null);
            linearLayout = (LinearLayout) view.findViewById(R.id.ll_xiangxi);
            layoutLinearDetail = (LinearLayout) view.findViewById(R.id. layoutLinearDetail);
            tv_name = (TextView) view.findViewById(R.id.tv_user_name);
            tv_email = (TextView) view.findViewById(R.id.tv_email);
            tv_jiaose = (TextView) view.findViewById(R.id.tv_jiaose);
            tv_jiandang = (TextView) view.findViewById(R.id.tv_jiandang);
            tv_phone = (TextView) view.findViewById(R.id.tv_phone);
            tv_shouji = (TextView) view.findViewById(R.id.tv_shouji);
            int width = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
            int height = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
            linearLayout.measure(width, height);
            length3 = linearLayout.getMeasuredHeight();
            tv_email.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                    clip.setText(tv_email.getText());
                    LayoutInflater inflater = LayoutInflater.from(Myinformation.this);
                    View  view = inflater.inflate(R.layout.copy_toast_layout,null);
                    ToastUtil toastUtil = new ToastUtil(Myinformation.this,view,Toast.LENGTH_SHORT);
                    toastUtil.show();
                }
            });
            initData();
            return view;
        }

        private void initData() {
            layoutLinearDetail.setBackgroundColor(Color.rgb(255,255,255));
            tv_name.setText(mUserBasicInfo.getName());
            tv_phone.setText(mUserBasicInfo.getPhone());
            tv_shouji.setText(mUserBasicInfo.getMobile());

            SaveTemporaryData.aboutEmail = mUserBasicInfo.getEmail();
            SaveTemporaryData.aboutNumber = mUserBasicInfo.getPhone();
            SaveTemporaryData.aboutMobile = mUserBasicInfo.getMobile();
            if ("YES".equals(Ownoneself)){
                tv_jiandang.setText(CApplication.jiandang);
                tv_jiaose.setText(CApplication.juese);
            }else if (SaveTemporaryData.GeneralOne){
                SaveTemporaryData.GeneralOne = false;
                tv_jiandang.setText(user.getProfilename());
                if ("".equals(user.getRolename())){
                    tv_jiaose.setText("null");
                }else{
                    tv_jiaose.setText(user.getRolename());
                }

            }

            tv_email.setText(mUserBasicInfo.getEmail());
        }

        @Override
        public void onResume() {
            super.onResume();
            setHeight(length3);
            if (mSmart == 1) {
                tv_email.setText(mEmail);
                tv_phone.setText(mNumber);
                tv_shouji.setText(mMobile);
                SaveTemporaryData.aboutEmail = mEmail;
                SaveTemporaryData.aboutNumber = mNumber;
                SaveTemporaryData.aboutMobile = mMobile;
                mSmart = 0;
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        MessageSetNCL();
        initdata();
        if(mSmart==1){
           setRadioBtnb();
        }else {
            setRadioBtnb();
        }
    }


    public void setHeight(final int height) {
        handler.post(new Runnable() {
            @Override
            public void run() {
                lp = new LinearLayout.LayoutParams(
                        LinearLayout.LayoutParams.MATCH_PARENT, height + 200);
                mViewPager.setLayoutParams(lp);
            }
        });
    }

    @Override
    public void register() {
        EventEngine.register(this);
    }

    @Override
    public void unRegister() {
        EventEngine.uregister(this);
    }
    public void getMemberNumbew() {
        if(mStrId == null || mStrId.length() <= 0){
            mStrId = RunTimeManager.getInstance().getUserId();
        }
        HttpUtils utils = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addBodyParameter("binding", RunTimeManager.getInstance().getServerBinding());
        params.addBodyParameter("serviceName", "getChatterGroupList");
        params.addBodyParameter("userId", mStrId);
        Log.d("requestxx", UrlManager.getInterfaceUrl() + "?binding=" + RunTimeManager.getInstance().getServerBinding() + "&serviceName=getChatterGroupList" + "&userId=" + mStrId);
        utils.send(HttpRequest.HttpMethod.POST, UrlManager.getInterfaceUrl(), params, new RequestCallBack<String>() {

            @Override
            public void onFailure(HttpException arg0, String arg1) {

            }

            @Override
            public void onSuccess(ResponseInfo<String> arg0) {

                Log.d("request查询客户Fail", arg0.result.toString());
                Gson gson = new Gson();
                CnumberBean follow = gson.fromJson(arg0.result.toString(), CnumberBean.class);
                if (follow.data!=null){
                    qunzu_tv.setText(getResources().getString(R.string.qunzu) + "(" + follow.data.size() + ")");
                }else{
                    qunzu_tv.setText(getResources().getString(R.string.qunzu) + "(" + "0" + ")");
                }

            }
        });
    }
    public void getGroupMember(){
        HttpUtils utils = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addBodyParameter("binding", RunTimeManager.getInstance().getServerBinding());
        params.addBodyParameter("serviceName", "getChatterGroupUsers");
        params.addBodyParameter("groupId", SaveTemporaryData.ID);
        Log.d("request成员",UrlManager.getInterfaceUrl()+"?binding="+RunTimeManager.getInstance().getServerBinding()+"&serviceName=getChatterGroupUsers"+"&groupId="+SaveTemporaryData.ID);
        utils.send(HttpRequest.HttpMethod.POST, UrlManager.getInterfaceUrl(), params, new RequestCallBack<String>() {

            @Override
            public void onFailure(HttpException arg0, String arg1) {
                // TODO Auto-generated method stub

                Log.d("request组成员Fail", arg1);
            }

            @Override
            public void onSuccess(ResponseInfo<String> arg0) {
                // TODO Auto-generated method stub
                Log.d("request组成员Success", arg0.result.toString());
                Gson gson = new Gson();
                CnumberBean follow = gson.fromJson(arg0.result.toString(), CnumberBean.class);
                if (follow.data==null){
                   try{
                       member.setText("成员("+"0"+")");
                   }catch (Exception e){

                   }
                    return;
                }

                try{
                    member.setText("成员("+String.valueOf(follow.data.size())+")");
                }catch (Exception e){

                }

//                groupMember.setText("公用"+" · "+String.valueOf(follow.data.size())+"位成员");
            }

        });

        }

    private void initMenu() {
        Fragment leftMenuFragment = new MenuRightFragment();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.id_Right_menu_frame, leftMenuFragment).commit();
        menu_R = new SlidingMenu(this);
        menu_R.setMode(SlidingMenu.RIGHT);
        menu_R.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE); // 触摸边界拖出菜单
        menu_R.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu_R.setOffsetFadeDegree(0.4f);
        menu_R.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        View viewRi = LayoutInflater.from(this).inflate(R.layout.right_menu_id,
                null);
        menu_R.setMenu(viewRi);
    }
    /**
     * 监听Back键按下事件,方法1:
     * 注意:
     * super.onBackPressed()会自动调用finish()方法,关闭
     * 当前Activity.
     * 若要屏蔽Back键盘,注释该行代码即可
     */
    @Override
    public void onBackPressed() {
        SaveTemporaryData.suoYouRen="";
        SaveTemporaryData.mSmart="member";
        SaveTemporaryData.General = false;
        SaveTemporaryData.detailDyamic = "detailDyamic";
        super.onBackPressed();
    }
    }

